//
// Created by 崔世强 on 2018/5/18.
// Copyright (c) 2018 Facebook. All rights reserved.
//

import Foundation
import WCDBSwift

class UserSettingDao {
    
    static func updateChatOpen(_ chatOpen:Bool) throws{
        let db = SQLiteHelper.getDb()
        let userSetting = UserSetting()
        userSetting.chatOpen = chatOpen
        try db.update(table: UserSetting.table, on: UserSetting.CodingKeys.chatOpen, with: userSetting)
    }
    
    static func get() throws -> UserSetting? {
        let db = SQLiteHelper.getDb()
        let userSetting:UserSetting? = try db.getObject(on: UserSetting.CodingKeys.all, fromTable: UserSetting.table)
        return userSetting
    }
}
